/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

//package server;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

/**
 *
 * @author josegarcia
 */
class Request {
    Socket socket = null;
    String messaje;
    public Request(Socket socket,String messaje){
    	this.socket=socket;
    	this.messaje=messaje;
    }
    public void execute(Boolean listening){
	    PrintWriter out=null;
	    BufferedReader in=null;

	    try{
		out = new PrintWriter(socket.getOutputStream(), true);

		

		
		if(messaje.equals("EXIT")){
		    out.close();
		    in.close();
		    socket.close();
		    /////////////////////////////////////Emitir mensaje para cerrar los sockets abiertos y luego terminar el programa servidor
		}
		String output="From Server: "+messaje;
		out.println(output);
		out.close();
		in.close();
		socket.close();





	    }catch(IOException e){
		System.out.println("Error IO en servidor");
		System.exit(-1);
	    }


    }
}
